﻿<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>computed()方法</title>
</head>
<body>
	<div id="app">
		<p>原始字符串：{{ message }}</p>
		<p>反转字符串：{{ reversedMessage }}</p>
	</div>


<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
	const {ref, computed} = Vue;
	const vm = Vue.createApp({
		setup() {
			const message = ref('一二三四五六七八九十');
			const reversedMessage = computed(() => message.value.split('').reverse().join(''))
			return {
				message,
				reversedMessage
			}
		}
	}).mount('#app');
</script>
</body>
</html>
